home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form ask_data
- BorderStyle = 1 'Fixed Single
- Caption = "Insert Data"
- ClientHeight = 1296
- ClientLeft = 36
- ClientTop = 264
- ClientWidth = 1824
- Icon = "ask_data.frx":0000
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 1296
- ScaleWidth = 1824
- StartUpPosition = 3 'Windows Default
- Begin VB.CommandButton Write_Button
- Caption = "Write"
- Default = -1 'True
- Height = 252
- Left = 480
- TabIndex = 1
- Top = 840
- Width = 852
- End
- Begin VB.TextBox DataText
- Alignment = 2 'Center
- Height = 288
- Left = 480
- MaxLength = 2
- TabIndex = 0
- Text = "00"
- Top = 240
- Width = 852
- End
- Attribute VB_Name = "ask_data"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- ' File - ask_data.frm
- ' This application reads and writes data to the Parallel Port, and is
- ' controlled via a graphical user interface - pp_gui.frm
- ' The Parallel Port is accessed directly on the motherboard, using
- ' WinDriver functions.
- Private Sub Form_Load()
- ask_data.DataText = Hex(g_Data)
- ask_data.DataText.Refresh
- ask_data.DataText.SelStart = 0
- ask_data.DataText.SelLength = 2
- End Sub
- Private Sub Write_Button_Click()
- If (ask_data.DataText = "") Then
- MsgBox "Data is empty.", vbExclamation + vbOKOnly, "Error"
- GoTo error
- End If
- If (Not IsHexText(ask_data.DataText)) Then
- MsgBox "The value you entered is not a valid Hexadesimal value." & Chr$(13) & _
- "Enter a new value.", vbExclamation + vbOKOnly, "Error"
- GoTo error
- End If
- g_Data = Val("&H" & ask_data.DataText)
- Unload ask_data
- GoTo finish
- error:
- ask_data.DataText = Hex(g_Data)
- ask_data.DataText.Refresh
- ask_data.DataText.SetFocus
- ask_data.DataText.SelStart = 0
- ask_data.DataText.SelLength = 2
- finish:
- End Sub
- Private Function IsHexText(str As String) As Boolean
- Dim str0, str1 As String
- str0 = Left(str, 1)
- str1 = Right(str, 1)
- If ((Val("&H" & str0) = 0) And (Asc(str0) <> 48)) _
- Or _
- ((Val("&H" & str1) = 0) And (Asc(str1) <> 48)) Then
- IsHexText = False
- Else
- IsHexText = True
- End If
- End Function
-